package jgcp.common;

import java.io.File;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
/**
 * @Date 28/05/2009
 * @author Jie Zhao (288654)
 * @version 1.0
 */
public class TaskDescription implements Serializable{
	private TaskType type = TaskType.EXE;
	private String exefile = "";
	private String dataFile = "";

	/**
	 * @return the type
	 */
	public TaskType getType() {
		return type;
	}
	/**
	 * @param type the type to set
	 */
	public void setType(TaskType type) {
		this.type = type;
	}
	/**
	 * @return the exefile
	 */
	public String getExefilename() {
		return new File(exefile).getName();
	}
	/**
	 * @param exefile the exefile to set
	 */
	public void setExefile(String exefile) {
		this.exefile = exefile;
	}
	/**
	 * @return the dataFile
	 */
	public String getDataFilename() {
		return new File(dataFile).getName();
	}
	/**
	 * @return the exefile
	 */
	public String getExefile() {
		return exefile;
	}
	/**
	 * @return the dataFile
	 */
	public String getDataFile() {
		return dataFile;
	}
	/**
	 * @param dataFile the dataFile to set
	 */
	public void setDataFile(String dataFile) {
		this.dataFile = dataFile;
	}
	public String toString() {
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		pw.println("type:"+type.toString());
		pw.println("exe:"+new File(exefile).getName());
		pw.println("data:"+new File(dataFile).getName());
		pw.flush();
		pw.close();
		return sw.toString();
	}
	public static void main(String[] args) {
		TaskDescription td = new TaskDescription();
		td.setDataFile("aaa");
		td.setExefile("ccc");
		td.setType(TaskType.EXE);
		System.out.println(td.toString());
	}
}
